﻿<%@ Page Language="C#" MasterPageFile="~/BasicBase/BasicBase.master" AutoEventWireup="true"
    CodeFile="NewEmployee.aspx.cs" Inherits="SoldierArchive_NewEmployee" Title=""
    StylesheetTheme="Content" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script type="text/javascript">
        function print() {
            window.open('Print.aspx');

        }
        function OpenWin(url) {
            var h = 480;
            var w = 640;
            var t = (screen.height - h) / 2;
            var l = (screen.width - w) / 2;
            window.open(url, null, 'left=' + l + ",top=" + t + ",width=" + w + ",height=" + h + ",toolbar=yes,scrollbars=yes,status=yes");
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ajaxToolkit:CalendarExtender ID="ceBirth" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="Birthday">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:CalendarExtender ID="ceJoinDate" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="JoinDate">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:CalendarExtender ID="ceYouthDate" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="YouthDate">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:CalendarExtender ID="cePartyDate" runat="server" Animated="False" Format="yyyy-MM-dd"
        TargetControlID="PartyDate">
    </ajaxToolkit:CalendarExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="ftbHeight" runat="server" FilterType="Numbers"
        TargetControlID="Height">
    </ajaxToolkit:FilteredTextBoxExtender>
    <ajaxToolkit:FilteredTextBoxExtender ID="ftbWeight" runat="server" FilterType="Custom, Numbers"
        TargetControlID="Weight" ValidChars=".">
    </ajaxToolkit:FilteredTextBoxExtender>
    <table border="0" cellpadding="0" cellspacing="0" class="dialog" width="100%">
        <caption>
            <asp:Label ID="ActionTitle" runat="server" Text="新增合同制队员基本档案"></asp:Label></caption>
        <tr>
            <td>
                <table border="0" cellpadding="4" cellspacing="0" width="100%">
                    <tr>
                        <td width="120">
                            单位：
                        </td>
                        <td colspan="3">
                            <asp:UpdatePanel ID="UpdatePanel3" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlDepartment_SelectedIndexChanged"
                                        DataTextField="ShortName" DataValueField="DepartmentID" Width="120px">
                                    </asp:DropDownList>
                                    <asp:DropDownList ID="ddlSection" runat="server" DataTextField="FullName" 
                                        DataValueField="DepartmentID" Width="240px">
                                    </asp:DropDownList>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlDepartment" EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td width="120">
                            编号：
                        </td>
                        <td>
                            <asp:TextBox ID="CardID" runat="server" SkinID="textbox_en" Width="80px"></asp:TextBox>
                            <asp:LinkButton ID="btnAutoWrite" Text="自动分配" runat="server" OnClick="btnAutoWrite_Click" />
                        </td>
                        <td width="120">
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            姓名：
                        </td>
                        <td>
                            <asp:TextBox ID="SoldierName" runat="server" SkinID="textbox_cn" Width="180px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="ReqSoldierName" runat="server" ControlToValidate="SoldierName">必需</asp:RequiredFieldValidator>
                        </td>
                        <td>
                            性别：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSex" runat="server" Width="188px">
                                <asp:ListItem Selected="True">男</asp:ListItem>
                                <asp:ListItem>女</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            民族：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlNation" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            职务：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlDuty" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            婚姻状况：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlMerriage" runat="server" Width="188px">
                                <asp:ListItem></asp:ListItem>
                                <asp:ListItem>未婚</asp:ListItem>
                                <asp:ListItem>已婚</asp:ListItem>
                                <asp:ListItem>离异</asp:ListItem>
                                <asp:ListItem>丧偶</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            家庭出身：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlBackground" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            籍贯：
                        </td>
                        <td colspan="3">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlProvinces" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProvinces_SelectedIndexChanged"
                                        Width="120px">
                                    </asp:DropDownList>
                                    <asp:DropDownList ID="ddlCities" runat="server" Width="240px">
                                    </asp:DropDownList>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlProvinces" EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            文化程度：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCulture" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            宗教信仰：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlReligion" runat="server" Width="188px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            出生日期：
                        </td>
                        <td>
                            <asp:TextBox ID="Birthday" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            工作时间：
                        </td>
                        <td>
                            <asp:TextBox ID="JoinDate" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            入团时间：
                        </td>
                        <td>
                            <asp:TextBox ID="YouthDate" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            入党时间：
                        </td>
                        <td>
                            <asp:TextBox ID="PartyDate" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            招聘所在地：
                        </td>
                        <td>
                            <asp:TextBox ID="JoinPlace" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            招聘合同编号：
                        </td>
                        <td>
                            <asp:TextBox ID="ConfirmID" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            专业一：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSpeciality1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSpeciality1_SelectedIndexChanged"
                                Width="188px">
                            </asp:DropDownList>
                        </td>
                        <td>
                            专业二：
                        </td>
                        <td>
                            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlSpeciality2" runat="server" Width="188px">
                                    </asp:DropDownList>
                                    </td>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlSpeciality1" EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            身高：
                        </td>
                        <td>
                            <asp:TextBox ID="Height" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>cm
                        </td>
                        <td>
                            体重：
                        </td>
                        <td>
                            <asp:TextBox ID="Weight" runat="server" SkinID="textbox_en" Width="180px"></asp:TextBox>kg
                        </td>
                    </tr>
                    <tr>
                        <td>
                            家庭住址：
                        </td>
                        <td colspan="3">
                            <asp:TextBox ID="HomePlace" runat="server" SkinID="textbox_en" Width="582px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            照片：
                        </td>
                        <td>
                            <asp:FileUpload ID="fileUpload" runat="server" />
                        </td>
                        <td colspan="2">
                            <asp:CheckBox ID="IsContract" runat="server" Checked="True" Text="是否是合同制" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Button ID="btnSave" runat="server" Text="添加" OnClick="btnSave_Click" />
                            <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="更新" Visible="False" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Label ID="lblInfo" runat="server" Width="300px"></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <asp:GridView ID="gvSoldiers" runat="server" AutoGenerateColumns="False" Caption="<span>本日最近更新</span>"
        DataKeyNames="SoldierID,DepartmentID" OnRowDeleting="gvSoldiers_RowDeleting"
        OnRowDataBound="gvSoldiers_RowDataBound">
        <Columns>
            <asp:BoundField DataField="CardID" HeaderText="编号" />
            <asp:TemplateField HeaderText="姓名">
                <ItemTemplate>
                    <a href="javascript:OpenWin('EmployeeView.aspx?ID=<%# Eval("SoldierID") %>');">
                        <%# Eval("SoldierName")%></a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="DepartmentName" HeaderText="单位" />
            <asp:BoundField DataField="Sex" HeaderText="性别" />
            <asp:BoundField DataField="NativeName" HeaderText="籍贯" />
            <asp:TemplateField HeaderText="入伍年月">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Convert.ToDateTime(Eval("JoinTime"))==DateTime.MinValue?"--": Convert.ToDateTime(Eval("JoinTime")).ToString("yyyy.MM") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:HyperLinkField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                DataNavigateUrlFields="SoldierID" DataNavigateUrlFormatString="NewEmployee.aspx?ID={0}"
                HeaderText="编辑" Text="&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;../../Images/Edit.gif&quot;/&gt;" />
            <%--<asp:HyperLinkField DataNavigateUrlFields="SoldierID" DataNavigateUrlFormatString="EmployeeView.aspx?ID={0}"
                HeaderText="查看" Text="&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;../../Images/UserView.gif&quot;/&gt;" />--%>
            <%--<asp:HyperLinkField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataNavigateUrlFields="SoldierID"
                DataNavigateUrlFormatString="~/Police/TransfeSoldier.aspx?ID={0}" HeaderText="调动"
                Text="&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;../../Images/TransfSolider.gif&quot;/&gt;" />--%>
            <asp:TemplateField HeaderText="删除" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:ImageButton ID="delteImage" ImageUrl="~/Images/delete.gif" OnClientClick="return confirm('您确认删除此兵员记录吗？')"
                        CommandName="Delete" runat="server" CausesValidation="false" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle HorizontalAlign="Left" />
        <RowStyle HorizontalAlign="Left" />
    </asp:GridView>
</asp:Content>
